﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.MobileControls;
using System.Collections;
using System.Data;

public partial class inboxlist : CommonPage
{
    VLGDataContext _db = new VLGDataContext();

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Page.Title = "Trang cá nhân | Hộp thư ";
            try
            {
                int idCurrentUser = Customer.idAcc;
                fillRepeat(idCurrentUser);
            }
            catch
            {
                Response.Redirect(ResolveClientUrl("yourPage.aspx"));
            }
        }
       // fillRepeat(Customer.idAcc);
    }
    void fillRepeat(int idCurUs)
    {
        var itemPM = from pms in _db.PMessages
                     where pms.idAccGui == idCurUs||pms.idAccNhan==idCurUs
                     select new { UserNhan2 = _db.VLGAccounts.Single(poc => poc.idAcc == pms.idAccGui).UsernameE, pms.NgayGui, pms.ndlandau, UserGui2 = _db.VLGAccounts.Single(poc => poc.idAcc == pms.idAccNhan).UsernameE, pms.idMess, pms.idAccGui, pms.idAccNhan };

        Repeater1.DataSource = itemPM;//.GroupBy(ac=>ac.relatedGig);
        Repeater1.DataBind();
    }
    protected void btnTiep2_Click(object sender, EventArgs e)
    {
        string noidung = TextBox1.Text.ToString().Trim();
        Response.Redirect(ResolveClientUrl("~/qlcongviec.aspx?op=add&to=") + noidung);
    }
}